N = int(input())
arr =[]
num_array = []
if(1<=N and N<=100000):
sum = 0
point = input()
str_num = ''
for i in point:
if ( i.isdigit()):
str_num += i
else:
if ( i == ' '):
arr.append(int(str_num))
str_num = ''
arr.append(int(str_num))
for i in arr:
if(i%2==0):
sum += i
elif(i%2!=0):
num_array.append(i)
cnt_array = len(num_array)
if (cnt_array % 2 != 0):
num_array.sort()
num_array.pop(0)
for i in num_array:
sum+=i
else:
for i in num_array:
sum+=i
print(sum)
else:
print(0)
//Believe in yourself ,( try and try and then try ), You can do it
#include <bits/stdc++.h>
#define ll long long
#define line "\n"
using namespace std;
ll summ(vector<ll>&arr );
void fast();
/*
index = (index+1) % n; // to right or back to 0
index = (index+n-1) % n; // to left or back to n-1
*/
int main()
{
fast();
unsigned ll n , temp , res=0 , total =0 , smallestOdd=LLONG_MAX , sumAllOdd=0;
vector<ll> arr;
cin>>n;
for(ll i=0; i<n; i++){
cin>>temp;
if(temp%2==0)
res+=temp;
else {
arr.push_back(temp); //push odds only
smallestOdd=min(smallestOdd , temp);
sumAllOdd+=temp;
}
total+=temp ;
}//arr is all odds
if(total%2==0) {cout<<total; return 0; }
ll len =arr.size();
// cout<<len<<" "<<sumAllOdd<<" "<<smallestOdd<<line;
if(len%2==0) res+=sumAllOdd;
else res+=sumAllOdd-smallestOdd;
cout<<res;
//idea is even + even is even and odd + odd = even but others are gonna give me odd.
//so all evens are gonna make even sum so i execulde them from pushing and i push all odds only
//and if # of array of odds is even so all of them are part of pairs of odd + odd but if
// # of array of odds is odd then so all of them are part of pairs of odd + odd except
//one which is the smallest odd cuz i wanna make max even.
}
void fast(){
cin.tie(nullptr);
cout.tie(nullptr);
cin.sync_with_stdio(0);
}
144A - Arrival of the General | 1106A - Lunar New Year and Cross Counting |
58A - Chat room | 230A - Dragons |
200B - Drinks | 13A - Numbers |
129A - Cookies | 1367B - Even Array |
136A - Presents | 1450A - Avoid Trygub |
327A - Flipping Game | 411A - Password Check |
1520C - Not Adjacent Matrix | 1538B - Friends and Candies |
580A - Kefa and First Steps | 1038B - Non-Coprime Partition |
43A - Football | 50A - Domino piling |
479A - Expression | 1480A - Yet Another String Game |
1216C - White Sheet | 1648A - Weird Sum |
427A - Police Recruits | 535A - Tavas and Nafas |
581A - Vasya the Hipster | 1537B - Bad Boy |
1406B - Maximum Product | 507B - Amr and Pins |
379A - New Year Candles | 1154A - Restoring Three Numbers |